package com.bsoft.gol.hcb.service.pay.diagnosis;

import com.alibaba.fastjson.JSONObject;
import com.bsoft.gol.hcb.utils.CommonUtils;
import com.bsoft.gol.hcb.utils.ResponseCode;
import com.bsoft.gol.hcb.utils.TradeType;
import com.bsoft.gol.mpi.model.Person;
import com.bsoft.gol.mpi.model.Unique;
import com.bsoft.gol.mpi.provider.IMPIProvider;
import com.bsoft.gol.mpi.service.MPIException;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import ctd.account.AccountCenter;
import ctd.controller.exception.ControllerException;
import ctd.net.rpc.Client;
import ctd.spring.boot.annotation.SsdevReference;
import ctd.spring.boot.annotation.SsdevService;
import ctd.util.JSONUtils;
import hcn.base.BasePropertyConfig;
import hcn.base.Organization;
import hcn.base.register.ISmsService;
import hcn.bean.PushMessageBean;
import hcn.common.CodeDefinition;
import hcn.common.Constants;
import hcn.enums.MsgServiceTypeEnum;
import hcn.enums.MsgTemplateCode;
import hcn.ods.DiagnosisPayTradeDetail;
import hcn.ods.PayTrade;
import hcn.pay.event.PayTradeFinishEvent;
import hcn.pay.service.IPayTradeProcessor;
import hcn.protocol.enumcase.PayResultBusType;
import hcn.protocol.ods.newdiagnosis.NewNotifyPayedRequestBean;
import hcn.protocol.ods.newdiagnosis.NewNotifyPayedResponseBean;
import hcn.protocol.ods.paymentXML.QueryPayedRequestBean;
import hcn.protocol.ods.paymentXML.QueryPayedResponseBean;
import hcn.util.BaseResponse;
import hcn.util.PayModeTransformUtil;
import hcn.util.RpcUserToken;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.atag.util.event.InheritableExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import pcn.enums.RoleIdEnum;
import service.rpc.BasePropertyConfigIntf;
import service.rpc.MessageSyncIntf;
import service.rpc.OrganizationInfoIntf;
import service.rpc.PayTradeIntf;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

@SsdevService("diagnosisPayTradeProcessorService")
public class DiagnosisPayTradeProcessorService implements IPayTradeProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(DiagnosisPayTradeProcessorService.class);
    @SsdevReference("hcn.smsService")
    private ISmsService smsService;
    private String adapterService;
    private String notifyMethodName;
    private String canRefundMethodName;
    @Autowired
    @Qualifier("hcnPayTradeService")
    private PayTradeIntf payTradeService;
    @SsdevReference("gol-mpi.mpiProvider")
    private IMPIProvider mpiProvider;

    @Autowired
    private MessageSyncIntf messageSyncService;

    @Autowired
    private OrganizationInfoIntf organizationInfoService;
    @Autowired
    private BasePropertyConfigIntf basePropertyConfigIntf;
    @Autowired
    private IPayTradeProcessor returnVisitPayTrade;
    @Autowired
    @Qualifier("hcnPayTradeService")
    private PayTradeIntf payTradeIntf;
    @Value("${sugg_tobe_repl_dist_url}")
    private String suggTobeReplDistUrl;
    /**
     * 处理成功前调用的接口，通常调用HIS交易成功接口
     *
     * @param payTrade
     * @return
     * @throws ControllerException
     */
    @Override
    public Object preProcessTradeSuccess(PayTrade payTrade) throws ControllerException {
        try {
            LOGGER.info("========payTrade: {}", JSONObject.toJSON(payTrade));
            LOGGER.info("========payServerTradeNo: {}", payTrade.getPayServerTradeNo());
            Organization organization = organizationInfoService.getOrgDetailByOrgId(payTrade.getOrgId());
            if (null == organization) {
                LOGGER.error("preProcessTradeSuccess failed.{}", "机构不存在");
            }
            Map<String, Object> extras = JSONUtils.parse(payTrade.getExtraData(), Map.class);
            //若是使用订单id下单的，就去云支付那边进行业务处理
            if(!Objects.isNull(extras.get("orderId"))){
                return returnVisitPayTrade.preProcessTradeSuccess(payTrade);
            }

            NewNotifyPayedRequestBean requestBean = NewNotifyPayedRequestBean.builder()
                    //机构标识
                    .orgId(payTrade.getOrgId())
                    //病人标识
                    .patientId(Objects.isNull(extras.get("patientId")) ? "" : String.valueOf(extras.get("patientId")))
                    //发票号码
                    .invoiceNumber(Objects.isNull(extras.get("invoiceNumber")) ? "" : String.valueOf(extras.get("invoiceNumber")))
                    //支付标志
                    .payState(Objects.isNull(extras.get("payState")) ? "" : String.valueOf(extras.get("payState")))
                    //支付成功时的通知信息
                    .notify(Objects.isNull(extras.get("notify")) ? "" : String.valueOf(extras.get("notify")))
                    //预结算标识
                    .paymentBudgetNumber(Objects.isNull(extras.get("paymentBudgetNumber")) ? "" : String.valueOf(extras.get("paymentBudgetNumber")))
                    //付款人
                    .payer(Objects.isNull(extras.get("payer")) ? "" : String.valueOf(extras.get("payer")))
                    //就诊序号
                    .visitId(Objects.isNull(extras.get("visitId")) ? "" : String.valueOf(extras.get("visitId")))
                    //自付金额
                    .totalFee(CommonUtils.isEmpty(extras.get("selfPay")) ? 0 : Double.valueOf((String) extras.get("selfPay")))
                    //抵用券列表
                    .voucherIdList(Objects.isNull(extras.get("voucherIdList")) ? null : (List<String>) extras.get("voucherIdList"))
                    .organizationId(organization.getLocalOrgId())
                    .payMode(PayModeTransformUtil.hcnPayModeToHis(payTrade.getPayType()))
                    .agtOrderNumber(payTrade.getPayServerTradeNo())
                    .payAmount(payTrade.getTotalFee())
                    .outOrderNumber(payTrade.getPayServerTradeNo())
                    .channelOrderNumber(payTrade.getExternalTradeNo())
                    .payTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()))
                    .build();
            List<Map<String, String>> feeRecords = (List<Map<String, String>>) extras.get("feeRecords");
            List<NewNotifyPayedRequestBean.NotifyPayedRequestFeeRecordBean> notifyPayedRequestFeeRecordBeans = null;
            if (feeRecords != null && !feeRecords.isEmpty()) {
                notifyPayedRequestFeeRecordBeans = new ArrayList<>();
                for (Map<String, String> map : feeRecords) {
                    NewNotifyPayedRequestBean.NotifyPayedRequestFeeRecordBean feeRecord = new NewNotifyPayedRequestBean.NotifyPayedRequestFeeRecordBean();
                    feeRecord.setFeeTypeCode(map.get("feeTypeCode"));
                    feeRecord.setFeeNo(map.get("feeNo"));
                    feeRecord.setFeeTypeName(map.get("feeTypeName"));
                    notifyPayedRequestFeeRecordBeans.add(feeRecord);
                }
                requestBean.setFeeRecords(notifyPayedRequestFeeRecordBeans);
            }
            String localOrgId = requestBean.getOrganizationId();
            //获取his Url
            requestBean.setHisUrl(organization.getProHisUrl());
            Object notifyPayed = new Object();

            QueryPayedRequestBean queryPayedRequestBean = new QueryPayedRequestBean();
            queryPayedRequestBean.setVisitOrganization(organization.getLocalOrgId());
            queryPayedRequestBean.setBusType(PayResultBusType.CLINIC_PAY.getTypeCode());
            queryPayedRequestBean.setBusTypeName(PayResultBusType.CLINIC_PAY.getTypeCodeName());
            queryPayedRequestBean.setOutOrderNumber(payTrade.getOutOrderNumber());

            QueryPayedResponseBean queryPayedResponseBean  = (QueryPayedResponseBean) Client.rpcInvoke("hcnInterface.diagnosisPayTradeService", "queryPayed", queryPayedRequestBean);

            BaseResponse<NewNotifyPayedResponseBean> payedResponseBeanBaseResponse = null;

            if(null != queryPayedResponseBean && "1".equals(queryPayedResponseBean.getPayStatus())){
                payedResponseBeanBaseResponse = new BaseResponse<>();
                NewNotifyPayedResponseBean newNotifyPayedResponseBean = new NewNotifyPayedResponseBean();
                newNotifyPayedResponseBean.setAgtOrderNumber(queryPayedResponseBean.getAgtOrderNumber());
                newNotifyPayedResponseBean.setResultId(queryPayedResponseBean.getPaymentNumber());
                newNotifyPayedResponseBean.setInvoiceNumber(queryPayedResponseBean.getInvoiceCode());
                newNotifyPayedResponseBean.setPaymentBudgetNumber(queryPayedResponseBean.getPaymentBudgetNumber());
                newNotifyPayedResponseBean.setFeeRecords(Lists.newArrayList());
                payedResponseBeanBaseResponse.setCode(ResponseCode.SUCCESS);
                payedResponseBeanBaseResponse.setData(newNotifyPayedResponseBean);
            }else {
                BasePropertyConfig propertyCode = basePropertyConfigIntf.getPropertyConfigByPropertyCode("013708", organization.getOrgId());
                if (null != propertyCode && "1".equals(propertyCode.getPropertyData())) {
                    notifyPayed = Client.rpcInvoke("hcnInterface.diagnosisPayTradeService", "notifyPayedXML", requestBean, localOrgId);
                } else {
                    notifyPayed = Client.rpcInvoke("hcnInterface.diagnosisPayTradeService", "notifyPayed", requestBean, localOrgId);
                }
            }

            if (null == notifyPayed) {
                throw new ControllerException("诊间支付回调失败");
            } else {
                payedResponseBeanBaseResponse = (BaseResponse<NewNotifyPayedResponseBean>) notifyPayed;
                if (null == payedResponseBeanBaseResponse) {
                    throw new ControllerException("诊间支付回调失败");
                } else if (payedResponseBeanBaseResponse.getCode() != 200) {
                    throw new ControllerException(payedResponseBeanBaseResponse.getMessage());
                }
            }

            for (Map<String, String> map : feeRecords) {
                String feeNo = map.get("feeNo");
                Client.rpcInvoke("cmc.medicalSkills", "dealNatPaySuccess", localOrgId, feeNo);
            }
            
            LOGGER.info("诊间支付回调成功:{}", notifyPayed);
            return notifyPayed;
        } catch (ControllerException e) {
            e.printStackTrace();
            throw new ControllerException(e.getMessage());
        } catch (Throwable throwable) {
            throwable.printStackTrace();
            LOGGER.error("preProcessTradeSuccess failed.", throwable);
            throw new ControllerException(throwable);
        }
    }

    /**
     * 处理系统业务成功
     *
     * @param payTrade
     * @param response
     * @throws ControllerException
     */
    @Override
    public void processTradeSuccess(PayTrade payTrade, Object response) throws ControllerException {
        Map<String, Object> extras = JSONUtils.parse(payTrade.getExtraData(), Map.class);
        //若是使用订单id下单的，就去云支付那边进行业务处理
        if(!Objects.isNull(extras.get("orderId"))){
            returnVisitPayTrade.processTradeSuccess(payTrade,response);
            return;
        }

        String resultId = null;
        String invoiceNumber = null;
        if (response != null) {
            BaseResponse<NewNotifyPayedResponseBean> resMap = (BaseResponse<NewNotifyPayedResponseBean>) response;
            LOGGER.debug("HIS returned data: {}", resMap);
            int resultCode = resMap.getCode();
            //医院业务处理失败
            if (resultCode != ResponseCode.SUCCESS) {
                LOGGER.info("诊间支付医院处理失败，resultCode:{}", resultCode);
                throw new ControllerException(CodeDefinition.NOTIFY_PAY_RESULT_FAILED, "HIS response: " + response);
            }

            String json = JSONObject.toJSONString(resMap.getData());
            NewNotifyPayedResponseBean newNotifyPayedResponseBean = JSONObject.parseObject(json, NewNotifyPayedResponseBean.class);
            LOGGER.info("nnewNotifyPayedResponseBean:{}", JSONUtils.writeValueAsString(newNotifyPayedResponseBean));
            resultId = newNotifyPayedResponseBean.getAgtOrderNumber();
            invoiceNumber = newNotifyPayedResponseBean.getInvoiceNumber();


            LOGGER.info("invoiceNumber:{}", invoiceNumber);
            if (StringUtils.isNotEmpty(invoiceNumber)) {
                String extraData = payTrade.getExtraData();
                if (StringUtils.isNotEmpty(extraData)) {
                    Map<String, Object> extraDataMap = (Map<String, Object>) JSONObject.parse(extraData);
                    LOGGER.info("extraDataMap:{}", JSONUtils.writeValueAsString(extraDataMap));
                    if (null != extraDataMap) {
                        extraDataMap.put("invoiceNumber", invoiceNumber);
                        payTrade.setExtraData(JSONUtils.writeValueAsString(extraDataMap));
                        try {
                            //异步执行方法
                            InheritableExecutor.instance().execute(() -> this.updateExtraData(payTrade));
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
            List<NewNotifyPayedResponseBean.FeeRecordsBean> feeRecordsBeanList=newNotifyPayedResponseBean.getFeeRecords();
            if(!CollectionUtils.isEmpty(feeRecordsBeanList)){
                List<String> feeRecordList=new ArrayList<>();
                for (NewNotifyPayedResponseBean.FeeRecordsBean feeRecordsBean:feeRecordsBeanList) {
                    feeRecordList.add(feeRecordsBean.getFeeNo());
                }
                try {
                    BaseResponse baseResponse= (BaseResponse)Client.rpcInvoke("hcb.cloudPayService",
                            "offlineCloudPayNotice", feeRecordList, newNotifyPayedResponseBean.getInvoiceNumber(),payTrade.getOrgId());
                    if(baseResponse.getCode()!=ResponseCode.SUCCESS){
                        LOGGER.warn("诊间支付支付云支付处方，修改本地处方状态失败{}",JSONObject.toJSONString(baseResponse));
                    }
                } catch (Throwable throwable) {
                    throwable.printStackTrace();
                    // 得到异常棧的首个元素
                    StackTraceElement stackTraceElement= throwable.getStackTrace()[0];
                    LOGGER.warn("诊间支付支付云支付处方，修改本地处方状态出错{}",JSONObject.toJSONString(stackTraceElement));
                }
            }
        }
        if (StringUtils.isNotEmpty(resultId)) {
            payTrade.setExternalTradeNo(resultId);
        } else {
            throw new ControllerException(CodeDefinition.NOTIFY_PAY_RESULT_FAILED, "HIS response: " + response);
        }
    }
    public void updateExtraData(PayTrade payTrade) {
        try {
            payTradeIntf.updateExtraData(payTrade.getTradeNo(), payTrade.getExtraData());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 处理系统业务成功后的业务
     *
     * @param payTrade
     * @throws ControllerException
     */
    @Override
    public void afterProcessTradeSuccess(PayTrade payTrade) throws ControllerException {

    }

    /**
     * 交易失败后的业务处理
     *
     * @param payTrade
     * @throws ControllerException
     */
    @Override
    public void processTradeFailed(PayTrade payTrade) throws ControllerException {

    }

    @Override
    public boolean canRefund(PayTrade payTrade) throws ControllerException {
        //不支持，支付成功后，线上退款
        try {
            String tradeNo = payTrade.getTradeNo();

            Map<String, Object> extra = JSONUtils.parse(payTrade.getExtraData(), HashMap.class);
            if (extra == null) {
                LOGGER.error("Cannot refund for trade: {}, trade status error: {}, {}", tradeNo);
                throw new ControllerException(CodeDefinition.PAY_TRADE_REFUND_FAILED, "该交易不允许退款，由于无支付明细数据。");
            }
            //调用his是否可退费
            Object[] param = new Object[4];
            param[0] = payTrade.getOrgId();
            if (extra.containsKey("patientId")) {
                param[1] = extra.get("patientId");
            }
            if (extra.containsKey("precalId")) {
                param[2] = extra.get("precalId");
            }
            if (extra.containsKey("feeRecords")) {
                List<Map<String, String>> list_last = new ArrayList<>();
                List<Map<String, String>> list = (List) extra.get("feeRecords");
                for (Map<String, String> map : list) {
                    Map<String, String> mapDic = new HashMap<String, String>();
                    if (map.containsKey("feeNo")) {
                        mapDic.put("feeNo", map.get("feeNo"));
                    }
                    if (map.containsKey("feeTypeCode")) {
                        mapDic.put("feeTypeCode", map.get("feeTypeCode"));
                    }
                    list_last.add(mapDic);
                }
                param[3] = list_last;
            }

            Map<String, String> map_return = ( Map<String, String> )Client.rpcInvoke("hcnAdapter" + "." + adapterService, canRefundMethodName, param);
            String allowRefundFlag = map_return.get("allowRefundFlag");
            //String resultId = map_return.get("resultId");
            if ("0".equals(allowRefundFlag)) {
                return false;
            }
            return true;
        } catch (Throwable throwable) {
            LOGGER.error("canRefund failed.", throwable);
            throw new ControllerException(throwable);
        }
    }

    @Override
    public void processReRefundSuccess(PayTrade payTrade) throws ControllerException {

    }


    @Override
    public void processReRefundFailed(PayTrade payTrade) throws ControllerException {

    }


    /***
     * @Author: zhusm@bsoft.com.cn
     * @Description: 诊间支付构建请求所需的参数
     * @CreateTime: 18:29 2019/5/17
     * @Params: [payTrade, params]
     * @return: java.util.Map<java.lang.String , java.lang.Object>
     **/
    @Override
    public Map<String, Object> createOrderExtraInfo(PayTrade payTrade, Map<String, Object> params) throws ControllerException {

        //若是使用订单id下单的，就去云支付那边进行业务处理
        LinkedHashMap bodyMap = (LinkedHashMap) params.get("body");//交易内容json字符串

        if(!Objects.isNull(bodyMap.get("orderId"))){
            return returnVisitPayTrade.createOrderExtraInfo(payTrade,params);
        }

        //支付统一改造
        LinkedHashMap jsonObject = (LinkedHashMap) params.get("body");//交易内容json字符串
        Object orgId = params.get("hospitalCode");
        Object invoiceNumber = Objects.isNull(jsonObject.get("invoiceNumber")) ? "" : jsonObject.get("invoiceNumber");
        Object notify = Objects.isNull(params.get("notify")) ? "" : params.get("notify");
        Object paymentBudgetNumber = jsonObject.get("paymentBudgetNumber");
        Object selfPay = params.get("amt");
        Object payState = Objects.isNull(params.get("payState")) ? "" : params.get("payState");
        Object patientId = Objects.isNull(jsonObject.get("patientCode")) ? "" : jsonObject.get("patientCode");
        Object visitId = Objects.isNull(jsonObject.get("visitId")) ? "" : jsonObject.get("visitId");
        String tradeNo = payTrade.getTradeNo();
        List<String> voucherIdList = null;
        if(null != params.get("voucherIdList")){
            voucherIdList = (List<String>) params.get("voucherIdList");
        }

        @SuppressWarnings("unchecked")
        List<Map<String, Object>> feeRecords = (List<Map<String, Object>>) jsonObject.get("feeRecords");
        if (feeRecords == null) {
            return new ImmutableMap.Builder<String, Object>().put("error_result", "feeRecords参数不允许为空").build();
        }
        for (Map<String, Object> record : feeRecords) {
            DiagnosisPayTradeDetail detail = new DiagnosisPayTradeDetail();
            detail.setFeeNo((String) record.get("feeNo"));
            detail.setFeeType((String) record.get("feeTypeCode"));
            detail.setOrgId((String) orgId);
            detail.setTradeNo(tradeNo);
            detail.setDetailId(orgId + "^" + detail.getFeeType() + "^" + detail.getFeeNo());
            payTradeService.saveDiagnosisPayTradeDetail(detail);
        }

        Person person = null;
        try {
//            person = ContextHelper.getSelfInfo(mpiProvider);
            String uid = RpcUserToken.getUserId();
            Unique unique = new Unique();
            unique.setIdType(Constants.USERID_TYPE_CODE);
            unique.setSource(Constants.USERID_SOURCE);
            unique.setUniqueId(uid);
            person = mpiProvider.getPersonByUnique(unique);
        } catch (MPIException e) {
            LOGGER.error("Cannot get person information for trade with No.: {}", tradeNo, e);
        }

        ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();

        builder.put("orgId", orgId)
                .put("notify", notify)
                .put("patientId", patientId)
                .put("visitId", visitId)
                .put("payState", payState)
                .put("invoiceNumber", invoiceNumber)
                .put("paymentBudgetNumber", paymentBudgetNumber)
                .put("tradeDate", new Date())
                .put("payer", (person == null || StringUtils.isEmpty(person.getPersonName())) ? "" : person.getPersonName())
                .put("selfPay", selfPay)
                .put("feeRecords", feeRecords).build();;

        if(null != voucherIdList){
            builder.put("voucherIdList", voucherIdList);
        }

        return builder.build();
    }

    /**
     * 整个交易完成（成功，失败）后通知调用接口
     *
     * @param event
     * @throws ControllerException
     */
    @Override
    public void notify(PayTradeFinishEvent event) throws ControllerException {
        try {
            PayTrade payTrade = event.getPayTrade();
            if (TradeType.getTradeType(payTrade.getTradeType()) == TradeType.diagnosisFee) {// @@ 诊间支付
                String userId = payTrade.getUserId();
                //国产化加密算法存储 解密
                String phoneNo = AccountCenter.getUser(userId).getMobile();
                //发送短信(smsService.asyncSendSms)
                PushMessageBean pushMessageBean = new PushMessageBean();
                pushMessageBean.setRoleId(RoleIdEnum.PATIENT.title());
                pushMessageBean.setMsgServiceType(MsgServiceTypeEnum.SMSSERVICE_ASYNCSENDSMS.getCode());
                pushMessageBean.setUserId(userId);
                pushMessageBean.setMobile(phoneNo);
                Map<String, String> variableMap = new HashMap<String, String>();
                if (event.getStatus() == PayTradeFinishEvent.TradeStatus.SUCCESS) {
                    String time = DateFormatUtils.format(payTrade.getFinishTime(), "yyyy-MM-dd HH:mm:ss");
                    Organization organization = organizationInfoService.getOrgDetailByOrgId(payTrade.getOrgId());
                    pushMessageBean.setTemplateCode(MsgTemplateCode.HOSPITALPAYSUCCESS.getCode());
                    variableMap.put("#医院名称#", organization.getFullName());
                    variableMap.put("#支付类型#", event.getPayType().getDisplay());
                    variableMap.put("#支付金额#", String.format("%.2f", payTrade.getTotalFee()));
                    variableMap.put("#时间#", time);
                    variableMap.put("#PatientName#", pushMessageBean.getName());
                    variableMap.put("#OrderType#",payTrade.getTradeType());
                    variableMap.put("#OrderAmount#",String.format("%.2f", payTrade.getTotalFee()));
                    variableMap.put("#PayTime#",time);
                    variableMap.put("#Title#", "医保报销后自费部分待缴费提醒！");
                    variableMap.put("#Hospital#",organization.getFullName());
                    variableMap.put("#TotalAmount#", String.format("%.2f", payTrade.getTotalFee()));
                    variableMap.put("#MedicalInsuranceReimbursement#","");//医保报销
                    variableMap.put("#AmountToBePaid#", "");//待支付金额
                } else {
                    pushMessageBean.setTemplateCode(MsgTemplateCode.HOSPITALPAYFAIL.getCode());
                }
                messageSyncService.productionMessage(pushMessageBean);
            }
        } catch (Throwable throwable) {
            throw new ControllerException(throwable);
        }
    }

    public void setNotifyMethodName(String notifyMethodName) {
        this.notifyMethodName = notifyMethodName;
    }

    public void setAdapterService(String adapterService) {
        this.adapterService = adapterService;
    }

    public void setSmsService(ISmsService smsService) {
        this.smsService = smsService;
    }

    public void setMpiProvider(IMPIProvider mpiProvider) {
        this.mpiProvider = mpiProvider;
    }

    public void setCanRefundMethodName(String canRefundMethodName) {
        this.canRefundMethodName = canRefundMethodName;
    }
}
